package Undefinied;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.StateBasedGame;

public class MapTest {
	public Image img;
	public Rectangle rect;
	public Image[]tileArray ;
	public int[][]Array;
	


	public void init(GameContainer gc, StateBasedGame sbg) {
		try {
			img=new Image("/data/Tiles/aqa.bmp");
			int x=img.getHeight()/16;
			int y=img.getWidth()/16;
			int d=(x+1)*(y+1);
			int m=0;
			tileArray=new Image[d];
			Array=new int[255][255]; 
			
			for(int i=0;i<=x;i++){
				for(int j=0;j<=y;j++){
					tileArray[m]=img.getSubImage(i*16, j*16, 16,16);
					Array[i][j]=(int)(Math.random()*64);
					m++;
				}
			}
			
		} catch (SlickException e) {
			e.printStackTrace();
		}
		
	}



	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) {
		int x=img.getHeight()/16;
		int y=img.getWidth()/16;
		for(int i=0;i<=x;i++){
			for(int j=0;j<=y;j++){
				g.translate(i*16, j*16);
				tileArray[Array[i][j]].draw();
				g.resetTransform();

			}
		}
		//img.draw();
	}



	public void update(GameContainer container, StateBasedGame sbg, int delta) {
		// TODO Auto-generated method stub
		
	}




}
